package com.jprocms.module.cms.enums;

/**
 * @author jprocms
 */
public enum EnumXxlJobTriggerStatus {

    /**
     * job状态 停止运行或未启动
     */
    STOP(0, "停止运行或未启动状态"),
    /**
     * job状态 运行
     */
    RUNNING(1, "运行状态"),
    ;

    private Integer code;
    private String desc;

    EnumXxlJobTriggerStatus(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static EnumJobStatus convert(EnumXxlJobTriggerStatus status) {
        switch (status) {
            case STOP:
                return EnumJobStatus.STOP;
            case RUNNING:
                return EnumJobStatus.RUNABLE;
            default:
                return EnumJobStatus.INIT;
        }
    }
}
